<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="board.*, java.util.*,model.*" %>

<%@ include file="../common/include/header.jsp" %>

<% DataForm dataForm = (DataForm)request.getAttribute("dataForm");%>

<div style="width: 980px;">
<table border="0" cellpadding="0" cellspacing="0" width="980px">
	<tr>
		<td style="width: 180px;vertical-align: top;background:  #fdb73a;">
			<%@include file="../common/include/leftmenu.jsp" %>
		</td>
			
			<html:form action="/databoard" enctype="multipart/form-data">
		<td style="vertical-align: top;width: 800px;">
			<%@include file="logo.jsp" %>
			<div class="boardname" style="text-align: center;"><bean:write name="dataForm" property="dbname"/></div>
				<input type="hidden" name="method" value="insert"/>
				<input type="hidden" name="dbname" value="<bean:write name="dataForm" property="dbname"/>"/>
				<input type="hidden" name="cono" value="<bean:write name="dataForm" property="cono"/>"/>
				<table border="0" cellpadding="0" cellspacing="0" width="700px" align="center">
					<tr><td style="width: 100px; text-align: center;height: 20px;">작성자</td>
						<td><bean:write name="dataForm" property="nick"/></td></tr>
					<tr><td style="width: 100px; text-align: center;height: 20px;">제　목</td>
						<td><html:text property="dbtitle" style="width: 600px;"></html:text>
						</td></tr>
					<tr><td colspan="2" style="width:700px; height: 400px">
							<textarea name="dbcontent" rows="20" cols="80"></textarea> 
						</td></tr>
					<tr><td style="width: 100px; text-align: center;height: 20px;">첨부파일</td>
						<td align="left">
							<html:file property="file" style="width: 580px;"/>
						</td></tr>
					<tr><td colspan="2" style="text-align: center;height: 20px;padding-top: 5px;">
							<html:link href="javascript: checkForm();"><img src="<%=imagePath %>icon_write.jpg"/></html:link>
							<html:link href="javascript: goList('getList');"><img src="<%=imagePath %>icon_list.jpg"/></html:link>	
						</td></tr>	 
				</table><br/>
		</td>
			</html:form>
	</tr>
</table>
</div>

<%@ include file="../common/include/footer.jsp" %>

<script type="text/javascript" src="<%=path%>/fckeditor/fckeditor.js"> </script>
<script type="text/javascript">
	
	window.attachEvent("onload", getfckeditor);
	 function getfckeditor(){
		var oFCKeditor = new FCKeditor('dbcontent') ;
		oFCKeditor.BasePath	= "<%=path%>/fckeditor/" ;
		oFCKeditor.ReplaceTextarea() ;
	}
	
</script>

<script type="text/javascript">
	function checkForm(){
		var form = document.dataForm;
		if(form.dbtitle.value==""|| form.dbtitle==/\s/g){
			alert("제목을 입력하시오");
			form.dbtitle.focus();
			return;
		}
		/*	
		if(form.dbcontent.value==""){
			alert("내용을 입력하시오");
			form.dbcontent.focus();
			return;
		}
		*/	
		if(form.dbtitle.value!=""){
			document.getElementById("dataForm").submit();
		}		
	}
	
	function goList(m){		
		var method = document.getElementById('method');
		//method.value ="";
		method.value = m;
		dataForm.submit();
	}
</script>



